package com.bustle.web.mbean.request;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import com.bustle.order.OrderManager;
import com.bustle.order.data.Lineitem;
import com.bustle.order.data.Order;

@ManagedBean(name="detailCommandeMB")
@RequestScoped
public class DetailsCommandeMBean {

	private Order order;
	private List<Lineitem> lineItems;
	@ManagedProperty(value = "#{param.orderId}")
	private int orderId;
	@EJB
	private OrderManager orderManager;
	
	@PostConstruct
	public void postConstruct(){
		order = orderManager.getById(orderId);
		lineItems = order.getLineItems();
	}
	
	public Order getOrder() {
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
	}
	public List<Lineitem> getLineItems() {
		return lineItems;
	}
	public void setLineItems(List<Lineitem> lineItems) {
		this.lineItems = lineItems;
	}
	public int getOrderId() {
		return orderId;
	}
	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}
	
}
